<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
    String path = request.getContextPath();
    if (path.length() > 0) path = path.substring(0, path.length() - 1);
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<jsp:include flush="true" page="/view/inc/incTop.jsp"/>
<!-- head-->
<script type="text/javascript">
    function reg() {
        var url = "<%=path %>/view/userinfo/userReg.jsp";
        var n = "";
        var w = "480px";
        var h = "500px";
        var s = "resizable:no;help:no;status:no;scroll:yes";
        openWin(url, n, w, h, s);
    }
    function login() {
        if (document.userLogin.userName.value == "") {
            alert("请输入用户名");
            return;
        }
        if (document.userLogin.userPw.value == "") {
            alert("请输入密码");
            return;
        }
        document.userLogin.submit();
    }

</script>
<hr>
<s:if test="#session.user==null">
    <div class="container">
        <div class="row">
            <h1 style="text-align: center;padding-top: 40px">用户登录</h1>
        </div>
        <div class="row">
            <div class="col-md-3"></div>
            <div class="col-md-6" style="padding-top: 40px">
                <form action="<%=path %>/userLogin.action" name="userLogin" method="post">
                    <div class="form-group row">
                        <label for="input1" class="col-sm-2 form-control-label">用户名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="input1" name="userName"
                                   placeholder="请输入用户名">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="input2" class="col-sm-2 form-control-label">密码</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="input2" name="userPw" placeholder="请输入密码">
                        </div>
                    </div>
                    <div class="form-group row">
                        <div class="col-sm-2"></div>
                        <div class=" col-sm-10">
                            <button type="button" onclick="login()" class="btn btn-success">登录</button>
                        </div>
                    </div>
                </form>
                <a style="float: right;" href="<%=path %>/view/user/userReg.jsp">没有账号?点击注册</a>
            </div>
        </div>
    </div>
</s:if>
<s:else>
    <br/>
    <h1>您已登录：<s:property value="#session.user.userName"/></h1> &nbsp;&nbsp;&nbsp;&nbsp;
    <a href="<%=path %>/userLogout.action">安全退出</a> &nbsp;&nbsp;&nbsp;&nbsp;
    <br/><br/><br/>
</s:else>
<hr>
<!--foot -->
<jsp:include flush="true" page="/view/inc/incFoot.jsp"/>
<!--foot -->	